/*
 * @Author: your name
 * @Date: 2020-06-09 11:36:08
 * @LastEditTime: 2020-07-02 09:59:37
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \v-nw-h5\src\store\modules\api\home\actions.js
 */
import Vue from 'vue';
// import router from '../../../../../router/index'
const _this = Vue.prototype
export default {
    //  NewAmusing页面的Api开始
    // 获取页面的推广视频
    getPageMsgApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/promotion/user/${params.userId}/query${params.headPromotionId}`
        return _this.xurl.postDataJsonLoading(url, params.data)
    },
    // 获取优惠卷的接口
    getAllCounponsFnApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/user/ticket/batch/receive/user/${_this.userId}`;
        return _this.xurl.postDataJsonLoading(url, params, false)
    },
    // 领取优惠卷接口
    getTemplateApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/user/ticket/${params}/receive/user/${_this.userId}`;
        return _this.postLoading(url)
    },
    /**
     * @description: // 关注和取消关注接口
     * @param {type} //like: 'do' ：关注  // 'cancel' ：取消关注
     * @return: 
     */
    doAttentionApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/concern/user/${_this.userId}/${params.like}?concernType=${params.concernType}&&concernKey=${params.concernKey}`;
        return _this.xurl.put(url)
    },
    // 获取评论信息的接口
    getSubCommentListApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/comment/user/${_this.userId}/query/sub?commentMainId=${params.mainId}&&pageNum=${params.pageNum}&&pageSize=${params.pageSize}`;
        return _this.xurl.get(url)
    },
    // 点赞和取消点赞
    isLikeApi ({ commit }, params) {
        //params.operation 点赞：do， 取消点赞 ： cancel
        let url = `${_this.NW_API_API_LOCALE_VERSION}/like/user/${_this.userId}/${params.operation}?likeType=${params.likeType}&&likeKey=${params.likeKey}`
        return _this.xurl.put(url)
    },
    // 评论
    doCommentApi ({ commit }, params) {
        //params.commentLink 主评论：main， 子评论 ： sub
        let url = `${_this.NW_API_API_LOCALE_VERSION}/comment/user/${_this.userId}/add/${params.commentLink}`;
        return _this.xurl.postDataJsonLoading(url, params.data)
    },
    // 估价api开始
    // 估价
    doAppraiseApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/${_this.userId}/join/interact/${params.actKey}/filler?fillerValue=${params.fillerValue}`;
        return _this.xurl.post(url)

    },
    /**
     * @description: 获取本人参与估价记录
     * @param {type} 
     * @return: 
     */
    InteractApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/get/${params.userId}/self/join/${params.appraiseId}/record`;
        return _this.xurl.get(url, params)
    },
    /**
     * @description: 分页获取用户参与估价记录
     * @param {type} 
     * @return: 
     */
    initRecordApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/query/filler/member/${params.appraiseId}?pageNum=${params.pageNum}&pageSize=${params.pageSize}`;
        return _this.xurl.get(url)
    },
    /**
     * @description: 分页获取店铺活动往期获奖记录
     * @param {type} 
     * @return: 
     */
    initHistoryPrizeRecordApi ({ commit }, { querys, params }) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/get/${params.userId}/${params.storeId}/past/winner`;
        return _this.xurl.get(url, querys)
    },
    /**
     * @description: 获取当前活动获奖名单
     * @param {type} 
     * @return: 
     */
    initCurPrizeRecordApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/${params.userId}/get/${params.appraiseId}/award/member`;
        return _this.xurl.get(url)
    },
    /**
     * @description: 活动预约通知
     * @param {type} 
     * @return: 
     */
    actAppointmentInformApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/user/${params.userId}/book/notice/${params.actType}/${params.actKey}?promotionId=${params.carrierId}`;
        return _this.xurl.post(url)
    },
    /**
     * @description: 获取均价走势图
     * @param {type} 
     * @return: 
     */
    initLineChartApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/${params.carrierId}/${params.appraiseId}/range/average/value`;
        return _this.xurl.get(url)
    },
    /**
     * @description: 获取估价详情
     * @param {type} 
     * @return: 
     */
    initAppraiseApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/detail/${params.appraiseId}/${params.userId}?promotionId=${params.carrierId}`;
        return _this.xurl.get(url)
    },
    /**
     * @description: 获得码的内容
     * @param {type} 
     * @return: 
     */
    initCodeApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/code/get/content`;
        return _this.xurl.postDataJsonLoading(url, params)
    },
    /**
     * @description: 获取简单店铺信息
     * @param {type} 
     * @return: 
     */
    getStoreInfoApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/store/simpleStore/${params}/info`;
        return _this.xurl.getLoading(url)

    },
    /**
     * @description: 获取微信分享信息
     * @param {type} 
     * @return: 
     */
    getShareBodyApi ({ commit }, { querys, storeId }) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/${storeId}/shareInfo`;
        return _this.xurl.get(url, querys)
    },
    // 互动中估价 助力
    initAppraiseHelpApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/interact/${params.interactId}/${params.helpUserId}/${params.thirdUserId}/help/${params.userId}/member`;
        return _this.xurl.postDataJson(url)
    },

    // 估价api结束


    // 获取主评论列表
    getUserMainCommentApi ({ commit }, params) {
        /*commentType 0:多媒体信息 1：店铺实景内容 2：店铺活动 3：店铺商品 4： 商家主页品牌*/
        let url = `${_this.NW_API_API_LOCALE_VERSION}/comment/user/${params.userId}/query/main?commentType=${params.commentType}&&commentKey=${params.commentKey}&&pageNum=${params.commentPageNum}&&pageSize=${params.commentPageSize}`;
        return _this.xurl.get(url)

    },
    //  NewAmusing页面的Api结束

    // NewLoook页面的Api开始


    /**
     * @description: 查询多媒体信息列表
     * @param {type} 
     * @return: 
     */
    getLookingMsgApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/media/info/query/page/${1}/num/${5}`;
        return _this.xurl.postDataJsonLoading(url, params)
    },
    /**
     * @description: 用户删除主评论
     * @param {type}    //userId: 21001           
                        //commentMainId: 1001  
     * @return: 
     */
    deleteCommentApi ({ commit }, params) {
        let url = `${_this.NW_API_vue}/comment/user/${params.userId}/delete/main/${params.mainId}`
        return _this.delete(url)
    },

    // NewLoook页面的Api结束

    // im页面的Api开始
    /**
     * @description: 获取客服的聊天群组chatGroupId
     * @param {type} ? storeId=102           ----店铺Id
                        & userId=2004           ----用户ID （未登录不传或传0）
                        & thirdId=10034         ----第三方ID （未登录不传或传0）
                        & enterType= 1           ----发送默认消息入口 （不传默认为0）
                        & enterTypeKey = 122     ----入口对应传入的key （不传默认为0） 
     * @return: 
     */
    getChatGroupIdApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/customer/service/chatGroupId/get?storeId=${params.storeId}&userId=${params.userId}&thirdId=${params.thirdId}&enterType=${params.enterType}&enterTypeKey=${params.enterTypeKey}`;
        return _this.xurl.get(url)
    },
    /**
     * @description: 获取店铺信息
     * @param {type} 
     * @return: 
     */
    getStoreMsgApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/store/${params.storeId}/home/info/user/${params.userId}`;
        return _this.xurl.get(url, params.thirdId)
    },
    /**
     * @description: 将群组内非自己的消息置为已读
     * @param {type} 
     * @return: 
     */
    alreadyReadApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/customer/service/message/read?chatGroupId=${params.chatGroupId}&userId=${params.userId}&thirdId=${params.thirdId}`;
        return _this.xurl.put(url)
    },
    /**
     * @description:添加用户客服消息发送记录 
     * @param {type} 
     * @return: 
     */
    sendServerAndPageApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/customer/order/message/user/add`;
        return _this.xurl.postDataJson(url, params)
    },
    // im页面的Api结束

    // 个人中心页面APi开始
    /**
     * @description: 获取用户卡包显示的统计数据 
     * @param {type} 
     * @return: 
     */
    getUserCashAccountApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/user/account/user/${params}/statistic/data`;
        return _this.xurl.get(url)
    },
    /**
     * @description: 本人主页和他人主页基本信息
     * @param {type} 
     * @return: 
     */
    getMineMsgApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/user/homepage/basic/${params.userId}/userHomePage/${params.visitId}/info`;
        return _this.xurl.get(url)
    },
    /**
     * @description: 根据经纬度获取当前市
     * @param {type} 
     * @return: 
     */
    getUserCityApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/location/city`;
        return _this.xurl.get(url, params)
    },
    /**
     * @description: 获得用户券列表
     * @param {type}    //userId = 10145                  ----用户id
     *                  page   = 1
     *                   num    = 10
     *                  data: {
     *                           queryType       = 0                     ----查询类型 0:全部,1:待使用,2:已过期,3:已使用 (非必填)
     *                           storeId         = 122                   ----店铺id (非必填)       
     *                           keyword         = "珠宝门店1"           ----门店名称关键字(非必传)  
     *                          industryTags    = [1,2,3]               ----行业类型标签(非必传)  
     *                       }      
     * @return: 
     */
    getUserCardListApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/user/ticket/query/user/${params.userId}/page/${params.page}/num/${params.num}`;
        return _this.xurl.postDataJson(url, params.data)
    },
    // 个人中心页面APi结束
    /**
     * @description: 领取手气红包
     * @param {type} 
     * @return: 
     */
    getRedDataApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/welfare/lucky/packet/${params.userId}/${params.thirdId}/${params.storeId}/${params.welPacketId}/${params.promotionId}/receive?terminalType=${params.terminalType}`;
        return _this.xurl.putSync(url)
    },
    /**
     * @description: 获取店铺官网菜单列表
     * @param {type} 
     * @return: 
     */
    getStoreWebsiteMenusApi ({ commit }, params) {
        let url = `${_this.NW_API_API_LOCALE_VERSION}/store/website/menu/list?storeId=${params}`
        return _this.xurl.get(url)
    },
    /**
     * @description: 发送语音验证码
     * @param {type} 
     * @return: 
     */
    sendVoiceCodeApi ({ commit }, params) {
        let url = _this.NW_API_vue + "/voice/code/send/phone/" + params;
        return _this.xurl.put(url)
    },
    /**
     * @description: 发送短信验证码
     * @param {type} 
     * @return: 
     */
    sendVerifyCodeAPi ({ commit }, params) {
        let url = _this.NW_API_vue + "/forgetPwd/code/send/phone/" + params;
        return _this.xurl.put(url)
    },


}